source https://github.com/patrickmichalina/typescript-monads/tree/master/src/result